/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.unal.agentes;

import jade.core.Agent;
import jade.wrapper.StaleProxyException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author raider
 */
public class Agente extends Agent{
    
    @Override
    protected void setup() {
// Printout a welcome message
        crearAgente("manufacturer1", BookManufacturerAgent.class.getName(), null);
        crearAgente("manufacturer2", BookManufacturerAgent.class.getName(), null);
        crearAgente("distributor", BookDistributorAgent.class.getName(), null);
        crearAgente("seller1", BookSellerAgent.class.getName(), null);
        crearAgente("seller2", BookSellerAgent.class.getName(), null);
        crearAgente("buyer", BookBuyerAgent.class.getName(), new Object[]{"Estudio en escarlata"});
    }
    
    public void crearAgente(String nombre,String clase,Object[]args){
        try {
            getContainerController().createNewAgent(nombre, clase, args).start();
        } catch (StaleProxyException ex) {
            Logger.getLogger(BookBuyerAgent.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
}
